import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useAppStore = defineStore('app', () => {
  // 侧边栏折叠状态
  const sidebarCollapsed = ref(false)
  
  /**
   * @description 切换侧边栏折叠状态
   */
  const toggleSidebar = () => {
    sidebarCollapsed.value = !sidebarCollapsed.value
  }
  
  /**
   * @description 设置侧边栏折叠状态
   * @param {boolean} status - 折叠状态
   */
  const setSidebarCollapsed = (status) => {
    sidebarCollapsed.value = status
  }
  
  return {
    sidebarCollapsed,
    toggleSidebar,
    setSidebarCollapsed
  }
}) 